package cn.edu.mju.dilidili.common.utils;

import lombok.AllArgsConstructor;

@AllArgsConstructor
/*
 * 7位错误码, 前三位是错误模块, 中间两位是子模块, 后面两位是具体错误
 * 101 无条件数据库操作
 * 102 通用模块
 * 103 系统用户
 * 404 未知
 * */
public enum StateCode {
    SUCCESS(0, "成功"),
    INSERT_ERROR(1010101, "插入失败"),
    SELECT_ERROR(1010201, "查找失败"),
    DELETE_ERROR(1010301, "删除失败"),
    CAPTCHA_ERROR(1020101, "验证码错误或已过期"),
    REGISTER_ERROR(1030101, "注册失败"),
    REGISTER_USERNAME_ERROR(1030111, "用户名不合法"),
    REGISTER_USERNAME_REPEAT_ERROR(1030112, "用户名已存在"),
    REGISTER_USERNAME_LOCK_ERROR(1030113, "该用户已被锁定"),
    REGISTER_PASSWORD_ERROR(1030121, "密码不合法"),
    REGISTER_GENDER_ERROR(1030131, "性别不合法"),
    REGISTER_BIRTH_ERROR(1030131, "出生日期不合法"),
    REGISTER_NICKNAME_ERROR(1030151, "不合法的昵称"),
    REGISTER_PHONE_ERROR(1030161, "不合法的手机号"),
    LOGIN_ERROR(1030201, "用户名或者密码错误"),
    LOGIN_USERNAME_ERROR(1030202, "用户名错误"),
    LOGIN_PASSWORD_ERROR(1030203, "密码错误"),
    OTHER_ERROR(9040404, "其他不知名的错误"),
    RUNTIME_ERROR(9010101, "发生了错误: \r\n%s"),
    AUTHORIZATION_ERROR(9010102, "权限不足"),
    VERIFY_ERROR(9010103, "信息验证失败"),
    ;
    public final Integer code;
    public final String msg;
}
